Preloader = function(){

	this.images = {};
	this.amount = 0;
	this.loaded = 0;

	this.init = function(images){

		for(var i = images.length; i>0; i-- ) {
			this.add(images[i-1]);
		}

	}

	this.add = function(filename){
		if( typeof this.images[filename] == 'undefined' ) {
			this.images[filename] = new Image();
			this.images[filename].src = filename;
			this.amount += 1;
			$(this.images[filename]).load(function(){
				this.loaded +=1 ;
				console.log('load');
				console.log(this.loadingStatus());
			}.bind(this));
		}
	}

	this.loadingStatus = function(){
		if( this.amount == 0 ) {
			return 1;
		}
		return this.loaded / this.amount;
	}
	
};